﻿// <copyright file="BaseMod.cs" company="SingularityShift">
// Copyright (c) 2009 SingularityShift.com
// </copyright>
// <author>Ben McClure</author>
// <email>ben@singularityshift.com</email>
// <date>2009-08-14</date>
// <summary>A Base implementation of a generic AbstractMod</summary>
namespace GameLib.Games.Components
{
    using GameLib.Games;
    using GameLib.Games.Util;

    /// <summary>
    /// A base implementation of an AbstractMod
    /// </summary>
    public class BasicMod : AbstractMod, IMod
    {
        /// <summary>
        /// Initializes a new instance of the BaseMod class.
        /// </summary>
        public BasicMod()
        {
        }

        /// <summary>
        /// Initializes a new instance of the BaseMod class, setting the owner game.
        /// </summary>
        /// <param name="owner">The IGame which owns this mod</param>
        public BasicMod(IGame owner)
        {
            Owner = owner;
        }

        /// <summary>
        /// Initializes a new instance of the BaseMod class, setting the owner and mod identifier
        /// </summary>
        /// <param name="owner">The IGame which owns this mod</param>
        /// <param name="id">A string identifier for the mod</param>
        public BasicMod(IGame<IMod> owner, string id)
            : this(owner)
        {
            Id = id;
        }

        /// <summary>
        /// Initializes a new instance of the BaseMod class, setting the owner, mod identifier, and title
        /// </summary>
        /// <param name="owner">The IGame which owns this mod</param>
        /// <param name="id">A string identifier for the mod</param>
        /// <param name="title">A human-readable title string for the mod</param>
        public BasicMod(IGame<IMod> owner, string id, string title)
            : this(owner, id)
        {
            Name = title;
        }

        /// <summary>
        /// Gets the ModState of this mod
        /// </summary>
        public override ModStates State
        {
            get
            {
                return GetState<IMod>();
            }
        }

        /// <summary>
        /// Initializes a new instance of the BaseMod class, setting the owner, mod identifier, title, and a filename
        /// </summary>
        /// <param name="owner">The IGame which owns this mod</param>
        /// <param name="id">A string identifier for the mod</param>
        /// <param name="title">A human-readable title string for the mod</param>
        /// <param name="file">A filename or file path for the mod</param>
        public BasicMod(IGame<IMod> owner, string id, string title, string file)
            : this(owner, id, title)
        {
            File = file;
        }
    }
}